package com.pi2e.view.activity;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.view.View.OnClickListener;

import com.pi2e.R;
import com.pi2e.view.base.BaseActivity;
import com.pi2e.view.common.FootView;
import com.pi2e.view.common.HeaderView;

public class StartReceCustomer extends BaseActivity {

	View mfootView;
	Handler handler;
	String flag = "";
	Runnable run = new Runnable() {
		public void run() {
			Intent it = null;

			it = new Intent(StartReceCustomer.this, HotelMainActivity.class);
			if ("Welcome".equals(flag)) {
				it.putExtra("FLAG", "Welcome");
			}
			startActivity(it);
			finish();
		}
	};

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		handler = new Handler(getMainLooper());
		flag = getIntent().getStringExtra("FLAG");
		handler.postDelayed(run, 2000);

	}

	@Override
	public HeaderView initHeaderView() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void setContentView() {
		setContentView(R.layout.activity_startrececustomer);

	}

	@Override
	public void initView() {
		// TODO Auto-generated method stub
		mfootView = findViewById(R.id.footId);
	}

	@Override
	public void initFootView() {
		FootView footView = new FootView(StartReceCustomer.this, mfootView);
		footView.getBtn_ok().setText("退 出");
		footView.getBtn_ok().setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {

				if (handler != null && run != null) {
					handler.removeCallbacks(run);
				}
				finish();
			}
		});
	}

}
